package com.zhihesj.anan.system.controller;


import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhihesj.anan.message.Message;
import com.zhihesj.anan.system.entity.DataSources;
import com.zhihesj.anan.system.service.DataSourcesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author anan
 * @since 2020-10-18
 */
@RestController
@RequestMapping("/system/data-sources")
public class DataSourcesController {

    @Autowired
    private DataSourcesService dataSourcesService;

    @GetMapping("/getDataSource")
    public Message getDataSource(DataSources dataSources){
        System.out.println(dataSources);
        Map map = JSON.parseObject(JSON.toJSONString(dataSources), Map.class);
        Collection collection = dataSourcesService.listByMap(map);
        return Message.success(collection);
    }

}
